package o;

import com.tencent.mm.opensdk.constants.ConstantsAPI.AppSupportContentFlag;
import java.io.IOException;

public final class afg {
    private static final int[] ˎ = new int[]{anr.ᐝ("isom"), anr.ᐝ("iso2"), anr.ᐝ("iso3"), anr.ᐝ("iso4"), anr.ᐝ("iso5"), anr.ᐝ("iso6"), anr.ᐝ("avc1"), anr.ᐝ("hvc1"), anr.ᐝ("hev1"), anr.ᐝ("mp41"), anr.ᐝ("mp42"), anr.ᐝ("3g2a"), anr.ᐝ("3g2b"), anr.ᐝ("3gr6"), anr.ᐝ("3gs6"), anr.ᐝ("3ge6"), anr.ᐝ("3gg6"), anr.ᐝ("M4V "), anr.ᐝ("M4A "), anr.ᐝ("f4v "), anr.ᐝ("kddi"), anr.ᐝ("M4VP"), anr.ᐝ("qt  "), anr.ᐝ("MSNV")};

    public static boolean ॱ(adv o_adv) throws IOException, InterruptedException {
        return ˎ(o_adv, true);
    }

    public static boolean ˊ(adv o_adv) throws IOException, InterruptedException {
        return ˎ(o_adv, false);
    }

    private static boolean ˎ(adv o_adv, boolean z) throws IOException, InterruptedException {
        long ॱ = o_adv.ॱ();
        long j = (ॱ == -1 || ॱ > AppSupportContentFlag.MMAPP_SUPPORT_PDF) ? AppSupportContentFlag.MMAPP_SUPPORT_PDF : ॱ;
        int i = (int) j;
        anc o_anc = new anc(64);
        Object obj = null;
        boolean z2 = false;
        int i2 = 0;
        int i3 = i;
        while (i2 < i3) {
            int i4 = 8;
            o_anc.ˏ(8);
            o_adv.ˎ(o_anc.ˏ, 0, 8);
            long ˋॱ = o_anc.ˋॱ();
            int ॱᐝ = o_anc.ॱᐝ();
            if (ˋॱ == 1) {
                i4 = 16;
                o_adv.ˎ(o_anc.ˏ, 8, 8);
                o_anc.ॱ(16);
                ˋॱ = o_anc.ॱˎ();
            } else if (ˋॱ == 0) {
                long ॱ2 = o_adv.ॱ();
                if (ॱ2 != -1) {
                    ˋॱ = (ॱ2 - o_adv.ˎ()) + ((long) 8);
                }
            }
            if (ॱ == -1 || ((long) i2) + ˋॱ <= ॱ) {
                if (ˋॱ >= ((long) i4)) {
                    i2 += i4;
                    int i5;
                    if (ॱᐝ != aeu.ˊˊ) {
                        if (ॱᐝ != aeu.ˎˏ && ॱᐝ != aeu.ˏˎ) {
                            if ((((long) i2) + ˋॱ) - ((long) i4) >= ((long) i3)) {
                                break;
                            }
                            i5 = (int) (ˋॱ - ((long) i4));
                            i = i2 + i5;
                            if (ॱᐝ == aeu.ˊ) {
                                if (i5 < 8) {
                                    return false;
                                }
                                o_anc.ˏ(i5);
                                o_adv.ˎ(o_anc.ˏ, 0, i5);
                                i4 = i5 / 4;
                                for (i5 = 0; i5 < i4; i5++) {
                                    if (i5 == 1) {
                                        o_anc.ˎ(4);
                                    } else if (ˊ(o_anc.ॱᐝ())) {
                                        obj = 1;
                                        break;
                                    }
                                }
                                if (obj == null) {
                                    return false;
                                }
                            } else if (i5 != 0) {
                                o_adv.ˊ(i5);
                            }
                            i2 = i;
                        } else {
                            z2 = true;
                            break;
                        }
                    }
                    i5 = ((int) ˋॱ) + i3;
                    if (ॱ == -1 || ((long) i5) <= ॱ) {
                        i3 = i5;
                    } else {
                        i3 = (int) ॱ;
                    }
                } else {
                    return false;
                }
            }
            return false;
        }
        if (obj == null || z != r3) {
            return false;
        }
        return true;
    }

    private static boolean ˊ(int i) {
        if ((i >>> 8) == anr.ᐝ("3gp")) {
            return true;
        }
        for (int i2 : ˎ) {
            if (i2 == i) {
                return true;
            }
        }
        return false;
    }
}
